// function title(obj){
//     var p = document.createElement("p");
//     p.innerText = obj.innerText;
//     return p;
// }
// 下面有同名方法。。。。。
// function missionBind(obj,father,type){
//     obj.onclick = function(){
//         var detailedTime = obj.getElementsByClassName("missionTime")[0];
//         var detailedContent = obj.getElementsByClassName("missionContent")[0];
//         var detaliedTitle = obj.getElementsByClassName("missionName")[0];
//         var personAccept = obj.getElementsByClassName("personAccept")[0];
//         var personSend = obj.getElementsByClassName("personSend")[0];
//         var price = obj.getElementsByClassName("price")[0];
//         var place = obj.getElementsByClassName("place")[0];
//         var check = obj.getElementsByClassName("check")[0];
//         var personNumberA = obj.getElementsByClassName("personNumberA")[0];
//         var personNumberS = obj.getElementsByClassName("personNumberS")[0];
//         father.appendChild(title(detailedTime));
//         father.appendChild(title(personSend));
//         father.appendChild(title(detaliedTitle));
//         father.appendChild(title(detailedContent));
//         father.appendChild(title(personAccept));
//         father.appendChild(title(price));
//         father.appendChild(title(place));
//         father.appendChild(title(check));
//         father.appendChild(title(personNumberS));
//         father.appendChild(title(personNumberA));
//
//
//         document.body.style.overflow = "hidden";
//         type.style.display = "block";
//
//     }
// }
//能量值经验条
function experience(molecule,denominator){//分子分母
    var exp = document.getElementById("exp");

    exp.style.width = molecule/denominator*100 + "%";
    if(molecule/denominator>=1){
        exp.style.width = "100%";
    }
    exp.innerHTML = molecule+"/"+denominator;
}

//更改个人信息的函数
function changeInformation(userName,schoolName,facultyName,energyNum,energyNumMax){
    var name = document.getElementById("userName");
    var school = document.getElementsByClassName("school");
    var faculty = document.getElementById("faculty");
    var faculity = document.getElementById('faculity');
    var userName1 = document.getElementById('name');
    school[0].innerHTML = schoolName;
    school[1].innerHTML = schoolName;
    name.innerHTML = userName;
    userName1.innerHTML = userName;
    faculty.innerHTML = facultyName;
    faculity.innerHTML = facultyName;
    experience(energyNum,energyNumMax);
}
//添加已接受/已发布任务
function appendMission(done,missionID,missionName,missionTime,missionContent,personNumberS,personSend,personNumberA,place,price){
    var missions = document.createElement("div");
    missions.className = "missions";
    if(typeof(personNumberA)=="undefined"){
        personNumberA="暂无";
    }
    missions.innerHTML = "<div class='avatar2'></div><p class='personSend'>"+personSend+
        "</p><p class='missionTime'>"+missionTime+
        "</p><p class='personNumberS'>"+personNumberS+
        "</p><p class='missionName'>"+missionName+
        "</p><p class='missionContent'>"+missionContent+
        "</p><p class='personNumberA'>"+personNumberA+
        "</p><p class='price'>"+price+
        "</p><p class='place'>"+place+
        "</p>";
    if(done == hid1){
        missions.innerHTML +="<button id="+missionID+" class='failedBtn'>放弃</button>";
    }else{
        missions.innerHTML +="<button id="+missionID+" class='seccessBtn'>完成</button>";
    }
    done.appendChild(missions);
}


function title(type,obj){
    var t = document.createElement(type);
    t.innerHTML = obj.innerHTML;
    return t;
}
var father = document.getElementById("mission");
var type = document.getElementById("elasticFrame");
function missionBind(){
        father.appendChild(title("div",this));
        document.body.style.overflow = "hidden";
        type.style.display = "block";
}
function createMission(personNumberS,personSend,missionTime,missionName,missionContent,energy,personNumberA,personAccept,check,place,missionId){
    var missions = document.getElementById("missions");
    var missionNew = document.createElement("div");
    var br = document.createElement('br');
    missionNew.className = "missionForm";
    missions.appendChild(missionNew);
    //开始添加form里边的东西
    myAppendChildClass(missionNew,"div","avatar","");
    myAppendChildClass(missionNew,"p","personNumberS",personNumberS);
    myAppendChildClass(missionNew,"p","personSend",personSend);
    myAppendChildClass(missionNew,"p","missionTime",missionTime);
    myAppendChildClass(missionNew,"p","missionMon","悬赏值:<span class='price'>"+energy+"</span>");
    myAppendChildClass(missionNew,"p","missionName",missionName);
    myAppendChildClass(missionNew,"p","missionContent",missionContent);
    myAppendChildClass(missionNew,"p","personNumberA",personNumberA);
    myAppendChildClass(missionNew,"p","personAccept",personAccept);
    myAppendChildClass(missionNew,"p","check",check);
    myAppendChildClass(missionNew,"p","place",place);
    var accept=myAppendChildClass(missionNew,"button","accept","接受");
    var think=myAppendChildClass(missionNew,"button","think","再想想/放弃");
    accept.setAttribute("id",missionId);
}